using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class BK_Ticket
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region BK_TicketSelectAll
        public static SqlDataReader BK_TicketSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_TicketSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_TicketSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region BK_TicketSelectRow
        public static SqlDataReader BK_TicketSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_TicketSelectRow", ID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_TicketSelectRow", ID);
        }
        #endregion
       #region BK_TicketSelectRowByForeignKey_BookingID
        public static SqlDataReader BK_TicketSelectRowByForeignKey_BookingID(int BookingID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_TicketSelectRowByForeignKey_BookingID", BookingID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_TicketSelectRowByForeignKey_BookingID", BookingID);
        }
        #endregion
       #region BK_TicketInsertRow
        public static void BK_TicketInsertRow(int ID, int BookingID, string FlightNo, DateTime StartDate, DateTime EndDate, int Price, int TypeID, bool IsDeleted, string FromCity, string ToCity, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_TicketInsertRow", ID, BookingID, FlightNo, StartDate, EndDate, Price, TypeID, IsDeleted, FromCity, ToCity);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_TicketInsertRow", ID, BookingID, FlightNo, StartDate, EndDate, Price, TypeID, IsDeleted, FromCity, ToCity);
        }
        #endregion
       #region BK_TicketUpdateRow
        public static void BK_TicketUpdateRow(int ID, int BookingID, string FlightNo, DateTime StartDate, DateTime EndDate, int Price, int TypeID, bool IsDeleted, string FromCity, string ToCity, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_TicketUpdateRow", ID, BookingID, FlightNo, StartDate, EndDate, Price, TypeID, IsDeleted, FromCity, ToCity);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_TicketUpdateRow", ID, BookingID, FlightNo, StartDate, EndDate, Price, TypeID, IsDeleted, FromCity, ToCity);
        }
        #endregion
       #region BK_TicketDeleteRow
        public static void BK_TicketDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_TicketDeleteRow", ID);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_TicketDeleteRow", ID);
        }
        #endregion

    }
}

